wayland: Signal gtk-shell surface destruction to the server
authorSebastian Keller <skeller@gnome.org>
Thu, 28 Jan 2021 21:31:03 +0000 (22:31 +0100)
committerSebastian Keller <skeller@gnome.org>
Thu, 28 Jan 2021 21:31:03 +0000 (22:31 +0100)
This adds a "release" destructor for the gtk_surface1 interface which
signals to the server that a surface has been destroyed on the client
side, which the current "destroy" does not do.

Ideally the protocol would have specified a destroy request marked as
destructor to handle this automatically, however this is no longer
possible due to the destroy method being implicitly generated in the
absence of an explicit request in the protocol. Adding a destroy request
marked as destructor now would generate a new destroy method that
unconditionally would send the request to the server, which would break
clients running on servers not supporting that request.

gdk/wayland/gdkdisplay-wayland.c
gdk/wayland/gdksurface-wayland.c
gdk/wayland/protocol/gtk-shell.xml

index 3acc10ed507a80efb0650a877fe3d646a7bddffc..b261c77fae5281b2040829f44612b997c49aed44 100644 (file)
@@ -94,7 +94,7 @@
 
 #define MIN_SYSTEM_BELL_DELAY_MS 20
 
-#define GTK_SHELL1_VERSION       3
+#define GTK_SHELL1_VERSION       4
 #define OUTPUT_VERSION_WITH_DONE 2
 #define NO_XDG_OUTPUT_DONE_SINCE_VERSION 3
 
index 0fd1b82a9b51024eac0bcc31a9f4b5580b8aee1e..d31e4ae6eef5133d67f137281c2746acae032d8c 100644 (file)
@@ -2967,7 +2967,11 @@ gdk_wayland_surface_hide_surface (GdkSurface *surface)
 
       if (impl->display_server.gtk_surface)
         {
-          gtk_surface1_destroy (impl->display_server.gtk_surface);
+          if (display_wayland->gtk_shell_version >=
+              GTK_SURFACE1_RELEASE_SINCE_VERSION)
+            gtk_surface1_release (impl->display_server.gtk_surface);
+          else
+            gtk_surface1_destroy (impl->display_server.gtk_surface);
           impl->display_server.gtk_surface = NULL;
           impl->application.was_set = FALSE;
         }
index fb91940b3090f140871b18bf50ccf7959f60325e..1aab593c424832597e39171d9204b22f87907207 100644 (file)
@@ -1,6 +1,6 @@
 <protocol name="gtk">
 
-  <interface name="gtk_shell1" version="3">
+  <interface name="gtk_shell1" version="4">
     <description summary="gtk specific extensions">
       gtk_shell is a protocol extension providing additional features for
       clients implementing it.
@@ -35,7 +35,7 @@
     </request>
   </interface>
 
-  <interface name="gtk_surface1" version="3">
+  <interface name="gtk_surface1" version="4">
     <request name="set_dbus_properties">
       <arg name="application_id" type="string" allow-null="true"/>
       <arg name="app_menu_path" type="string" allow-null="true"/>
@@ -82,6 +82,9 @@
     <request name="request_focus" since="3">
       <arg name="startup_id" type="string" allow-null="true"/>
     </request>
+
+    <!-- Version 4 additions -->
+    <request name="release" type="destructor" since="4"/>
   </interface>
 
 </protocol>